<?php
class Application_Model_User{
	
	protected $_userId;
	protected $_email;
	protected $_firstName;
	protected $_lastName;
	protected $_password;
	protected $_sex;
	protected $_country;
	protected $_day;
	protected $_month;
	protected $_year;
	protected $_token;
	protected $_mobile;
	protected $_avatar;
	protected $_birthday;
	
	public function __construct(array $options = null){
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value){
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid user property');
		}
		$this->$method($value);
	}
	
	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid user property');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	/**
	 * @return the $_userId
	 */
	public function getUserId() {
		return $this->_userId;
	}

	/**
	 * @param field_type $_userId
	 */
	public function setUserId($_userId) {
		$this->_userId = $_userId;
	}

	public function setToken($token){
		$this->_token = (string) $token;
		return $this;
	}
	
	
	public function setEmail($email){
		$this->_email = (string) $email;
		return $this;
	}
	
	public function setFirstName($firstName){
		$this->_firstName = (string) $firstName;
		return $this;
	}
	
	public function setLastName($lastName){
		$this->_lastName = (string) $lastName;
		return $this;
	}
	
	public function setPassword($password){
		$this->_password = (string) $password;
		return $this;
	}
	
	public function setSex($sex){
		$this->_sex = (string) $sex;
		return $this;
	}
	public function setCountry($country){
		$this->_country = (string) $country;
		return $this;
	}
	
	public function setDay($day)
	{
		$this->_day = (int) $day;
		return $this;
	}
	public function setMonth($month)
	{
		$this->_month = (int) $month;
		return $this;
	}
	public function setYear($year)
	{
		$this->_year = (int) $year;
		return $this;
	}
	
	
	
	public function getToken(){
		return $this->_token;
	}
	
	/**
	 * @return the $_mobile
	 */
	public function getMobile() {
		return $this->_mobile;
	}

	/**
	 * @param field_type $_mobile
	 */
	public function setMobile($_mobile) {
		$this->_mobile = $_mobile;
	}

	public function getEmail(){
		return $this->_email;
	}
	
	public function getFirstName(){
		return $this->_firstName;
	}
	
	public function getLastName(){
		return $this->_lastName;
	}
	
	public function getPassword(){
		return $this->_password;
	}
	
	public function getSex(){
		return $this->_sex;
	}
	
	public function getCountry()
	{
		return $this->_country;
	}
	
	public function getDay()
	{
		return $this->_day;
	}
	
	public function getMonth()
	{
		return $this->_month;
	}
	
	public function getYear()
	{
		return $this->_year;
	}

	/**
	 * @return the $_avatar
	 */
	public function getAvatar() {
		return $this->_avatar;
	}


	/**
	 * @param field_type $_avatar
	 */
	public function setAvatar($_avatar) {
		$this->_avatar = $_avatar;
	}
	/**
	 * @return the $_birthday
	 */
	public function getBirthday() {
		return $this->_birthday;
	}

	/**
	 * @param field_type $_birthday
	 */
	public function setBirthday($_birthday) {
		$this->_birthday = $_birthday;
	}


	
	
}